﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Agro.Models;
using SN.Data;

namespace Agro.Services
{
    public class BbsService :  BaseService,IBbsService
    {
        public List<bx_Posts> GetPostList(int topsize)
        {
            Field[] field = new Field[] { bx_Posts._.Subject, bx_Posts._.CreateDate, bx_Posts._.ThreadID, bx_Posts._.PostType, bx_Posts._.FloorNumber, bx_Forums._.CodeName.As("CodeName") };
            List<bx_Posts> dt = (List<bx_Posts>)DB.From<bx_Posts>().LeftJoin<bx_Forums>(bx_Posts._.ForumID==bx_Forums._.ForumID).Where(bx_Posts._.Subject != "").Select(field).OrderBy(bx_Posts._.CreateDate.Desc).GetTop(topsize).ToList();
            return dt;
        }
    }
}
